home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-06-06 | 9.0 KB | 223 lines | [TEXT/Rich] |
- PROGRAM Skel;
-
- Original Lisa Pascal version written by
- Steve Maker
- Academic Computing
- Kiewit Computation Center
- Dartmouth College
- July 14, 1984
-
- Translated for Megamax C compiler by
- Bill Jefferys
- Astronomy Department
- University of Texas
- Austin TX 78712
- March 11, 1985
-
- Simple convert to Lightspeed C by
- Michael Peirce
- 1258 Manet Drive
- Sunnyvale, CA 94087
- June 16, 1986
-
- Some fixes for newer Think C plus Think Pascal conversion (back to Pascal again!),
- WaitNextEvent support and Apple Events by
- Ingemar Ragnemalm
- ingemar@lysator.liu.se
-
-
- Copyright notice:
- SKEL may be copied and used by anyone, so long as that use
- is not for commercial purposes. Please send significant
- changes back to Steve Maker for incorporation into future
- versions.
-
- Why SKEL?
- Skel is a skeleton demo program. Its purpose is to illustrate
- in a clear fashion, isolated from any particular application,
- the basic code for handling a simple Macintosh user interface.
-
- It strives to be correct as far as it goes, without many
- short-cuts that would lead to trouble in larger applications.
-
- I think of SKEL as a program that does nothing, but does
- it well.
-
- What does SKEL do?
- It handles:
- Events, carefully handling only those which are its
- business, and passing the others on to their
- respective handlers.
- A Window, which is filled with Dark Gray, and can be
- activated or inactivated, updated, dragged
- and grown but NOT scrolled or closed.
- Menus, including the Apple Menu. An "About Skel" menu entry
- is provided. A File menu offers Rattle and
- Frighten, which just invoke dialog boxes, and Quit.
- Command key equivalents are supported.
- The Desk Accessories, supported in the Apple menu,
- and correctly meshed with the other features.
- NOT supported are Undo, Cut, Copy, Paste and Clear
- (and keyboard equivalents) for desk accessories.
- A Modal Dialog Box, used to communicate with the user.
- Special icons for the application and its related files.
- The Finder information (in the resource file).
-
- In accordance with Macintosh guidelines, everything possible is
- kept in the resource file: window description, menus,
- dialog specification, and the "About Skel" and other strings.
-
- In addition, the resource file handles the Bundle, File
- References, and Icons that determine what Skel's icon looks
- like, and other information for the Finder.
-
- How do I use SKEL?
- Study it. Modify it to test your knowledge. Steal working
- pieces of code for your own programs. Beat on it. Subject
- it to cruel and unusual experiments. Pay heed to its warnings.
-
- What do I study first in SKEL?
- Initially you should ignore several sections of SKEL, and the
- calls made to them. I recommend X-ing them out in your listing.
- The sections to ignore on the first round of study are:
-
- Report: ignore the implementation
- SetUpMemory: ignore all of it
- DrawWindow: ignore the scroll bar and grow icon handling
- ReSize: ignore all of it
- DoCommand: ignore the Desk Accessory handling in the
- Apple Menu
- MainEventLoop:
- mouseDown handling: ignore inSysWindow, inDrag, inGrow
- keyDown, autoKey handling: ignore this.
-
- In the resource definition file, SKEL.R:
- Finder information (offset by asterisks):
- ignore this whole section, icons and all.
-
- What should I read in Inside Macintosh?
- You should read the following sections of Inside Macintosh,
- in the order given. At first, just lightly skim the sections
- with parenthesized names. Read the others in some depth. Read
- the starred (*) ones in great detail. Eventually, you will
- have to read all sections thoroughly, and many many times,
- I promise you.
-
- To start:
- * Inside Macintosh: A Road Map
- (User Interface Guidelines)
- Structure of a Macintosh Application
- * Putting Together a Macintosh Application
-
- Then, (low-level sections are listed first):
- * Memory Mgr Intro
- (Memory Mgr)
- * Resource Mgr (through "Using the Resource Mgr")
- * QuickDraw
- (Desk Mgr)
- * Event Mgr (through "Event Mgr routines")
- Window Mgr
- Menu Mgr
- (Dialog Mgr)
-
- How do I get SKEL to run?
- Double-click Skel.π (the project file), and then select "Go".
-
- What is the history of SKEL?
- v1.0 July 14, 1984 sm: major revision of earlier version
- Sept 30, 1984 sm: used \14 for apple symbol in res. file,
- bracketed OpenDeskAcc with Get and SetPort,
- Oct 11, 1984 sm: changed FREF, BNDL resources from HEXA
- to readable,
- nested some routines in SKEL,
- added constants for FILE menu items,
- v2.0 Nov 12, 1984 sm: made resources pre-loaded and/or purgeable,
- turned off range-checking,
- documented no Resume proc passed to
- InitDialogs,
- added SetUpMemory:
- calls MoreMasters, MaxApplZone,
- sets the NIL address to -1,
- lots of general memory doc.
- added a warning about passing doubly-
- dereferenced handles,
- removed en/disabling of Rattle and
- Frighten items,
- v2.1 Dec 4, 1984 sm: added menu key handling,
- put Rattle and Frighten strings in res file,
- rewrote intro documentation
-
- v2.2 Mar 6, 1985 sm: converted to % describes,
- Fixed SKELX for both 2.0 and 3.0 workshop,
- set the event mask
-
- v2.2C 3/11/85 whj: converted to Megamax "C"; future Megamax "C"
- version numbers will have the same version
- number as the corresponding Pascal version,
- but with an appended "C".
-
- v2.2.1C 4/1/85 whj: Added in-place conversion of Pascal strings
- to C strings for the string resources. Uses
- new procedure "initStrRes", included in
- this file. This is a kludge required because
- the RMaker program supplied does not
- support C-Style strings. v. 2.0 of Megamax C
- is different in its handling of string
- resources than v. 1.2, which necessitated this
- change. Strings resources must not be
- purgeable for this to work.
-
- Also modified the header file "qdvars.h" which was
- supplied with Megamax C v. 2.0. Use the new version
- in place of the Megamax version; the interface will
- be similar to the Lisa Pascal interface.
-
- v.2.2.2C 5/20/85 whj: Corrected two minor bugs reported on Usenet.
- The bugs apparently had no effect on the operation
- of the program.
-
- The distribution version of the program has been
- converted to Inside Macintosh toolbox names using
- Convert. To use with Megamax C Compiler, use
- Convert as distributed with Version 2.0, with the
- "-L" argument to get a file containing all lowercase
- toolbox calls.
-
- v. 2.2.3C 8/1/85 whj: C-Style strings put into the Resource Fork
- following a suggestion of Joel West, of CACI, Inc
- (USENET: gould9!joel; ARPANET: gould9!joel@NOSC.ARPA).
- This uses the RMaker type 'GNRL' to Create
- null-terminated strings in the Resource Fork.
- "initStrRes" kludge eliminated.Special handling
- of periods (ASCII 2E) is required. See skel.r for
- details. Thank you, Joel!
-
-
- v. 2.2.3LSC 6/16/86 mrp: Works under Lightspeed C now. Took out
- "C-style" strings; converted some &points; changed the
- includes; random others stuff. Also broke up the source
- to better fit into Lightspeed's project organization.
-
-
- ---
-
- v. 3.0i, 1994, LIR
-
- In 1994 - 8 years after the last revision above - I digged up these old SKEL
- sources again, primarily for testing a C-to-Pascal converter (Dan's Source
- converter). Then I thought I could just as well improve on it, make some
- minimal modernizations:
-
- - WaitNextEvent support
- - suspend/resume events
- - minimal Apple Event support (i.e. Quit)
- - color support, using a "ppat" for filling the window
- - Added color icons for the Finder, SIZE and vers resources.
-
- All was done without losing backwards compatibility!
-
- Some minor changes: TEXT resources were not used, and were removed. I no longer
- include a .r file.
-
- What is then left? AppleScript support, I guess.
-